<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01-自增自减</title>
</head>
<body>
    <script>
        let num = 5;
        num = num + 1;
        // 自增运算符：自加1后，重新赋值给自己
        // 后置运算符  num++; 
        // 前置运算符  ++num; 

        // 自减运算符
        //  num--;
        //  --num;

        console.log(num);

        console.log('-----------------');

        var score = 10;
        // 后置运算符，先返回，后加1
        console.log(score++ +5);        //15
        console.log(score);             //11

        var age =18;
        // console.log(++age);     //19
        console.log(++age + 2);     //21
        console.log(age);       //19

        // 尽量单独写一行，避免容易混淆的写法

    </script>
</body>
</html>